/*
package com.monster.servlet.home;

import com.monster.test.SongTest;
import com.monster.test.SongTestDao;

import javax.servlet.ServletException;
import javax.servlet.ServletInputStream;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

@WebServlet("/imageUpload")
public class UploadServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        String fileName = request.getParameter("name");
        String imgType = request.getParameter("imgType");
        String tid = request.getParameter("tid");
        if ("user-head".equals(imgType)) {
            // Long userId = Long.parseLong(tid);
            fileName = "user-id=" + tid + fileName.substring(fileName.indexOf("."));
        }
        ServletInputStream inputStream = request.getInputStream();
        SongTestDao std = new SongTestDao();
        SongTest st = new SongTest();
        st.setPoster(inputStream);
        System.out.println(std.addSong(st));
        */
/*String path = request.getServletContext().getRealPath("/image/upload");
        File file = new File(path);
        if (!file.exists()) {
            file.mkdirs();
        }
        FileOutputStream fos = new FileOutputStream(path + "/" + fileName);
        int data = 0;
        while ((data = inputStream.read()) != -1) {
            fos.write(data);
        }
        fos.close();
        inputStream.close();*//*

        PrintWriter out = response.getWriter();
        out.print("success");
        out.flush();
        out.close();

    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request, response);

    }

}
*/
